package com.xiaocai.objview;

import android.content.Context;
import android.opengl.GLES20;

public class LoadingCubeShaderProgram extends ShaderProgram {
    private final String A_POSITION = "a_Position";

    private final String A_COLOR = "a_Color";

    private final String U_MATRIX = "u_Matrix";

    private int aPositionLocation;

    private int aColorLocation;

    private int uMatrixLocation;

    public LoadingCubeShaderProgram(Context context) {
        super(context, R.raw.loading_vertex_shader, R.raw.loading_fragment_shader);
        aPositionLocation = GLES20.glGetAttribLocation(program, A_POSITION);
        aColorLocation = GLES20.glGetAttribLocation(program, A_COLOR);
        uMatrixLocation = GLES20.glGetUniformLocation(program, U_MATRIX);
    }

    public void setUniforms(float[] matrix) {
        GLES20.glUniformMatrix4fv(uMatrixLocation, 1, false, matrix, 0);
    }

    public int getPositionLocation() {
        return aPositionLocation;
    }

    public int getColorLocation() {
        return aColorLocation;
    }
}
